package com.example.xianji.activity;

import java.util.ArrayList;

import com.example.xianji.R;
import com.example.xianji.adapter.Help_Adapter;

import android.os.Bundle;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.RelativeLayout;

public class Main_HelpActivity extends Activity {
    private ListView help_listview;
    private Help_Adapter mHelp_Adapter;
    private ArrayList<String> data;
    private RelativeLayout help_back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        }
        setContentView(R.layout.activity_main__help);
        //XJApplication.getInstance().addActivity(this);
        help_listview = (ListView) findViewById(R.id.help_listview);
        help_back = (RelativeLayout) findViewById(R.id.help_relative_back);
        data = new ArrayList<String>();
        data.add("企业如何入驻贤集网?");
        data.add("用户如何发布需求?");
        data.add("用户如何申请对接?");
        data.add("个人用户如何发布服务?");
        mHelp_Adapter = new Help_Adapter(data, Main_HelpActivity.this);
        help_listview.setAdapter(mHelp_Adapter);
        help_back.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Main_HelpActivity.this.finish();
            }
        });

        help_listview.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (data.get(position).equals("企业如何入驻贤集网?")) {
                    Main_HelpActivity.this.startActivity(new Intent(Main_HelpActivity.this, Main_QiYe_ZenYang_RuZhuActivity.class));
                } else if (data.get(position).equals("用户如何发布需求?")) {
                    Main_HelpActivity.this.startActivity(new Intent(Main_HelpActivity.this, Main_YongHu_zenyang_fabu_XuqiuActivity.class));

                } else if (data.get(position).equals("用户如何申请对接?")) {
                    Main_HelpActivity.this.startActivity(new Intent(Main_HelpActivity.this, Main_YongHu_ZenYang_duijieActivity.class));
                } else if (data.get(position).equals("个人用户如何发布服务?")) {
                    Main_HelpActivity.this.startActivity(new Intent(Main_HelpActivity.this, Main_GeRen_ZenYang_send_fuwuActivity.class));
                }
            }
        });
    }
}
